<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>{config('system_title')} - {config('COPYRIGHT.COPYRIGHT_NAME')}</title>
    <meta name="keywords" content="{config('system_keywords')}"/>
    <meta name="description" content="{config('system_description')}" />
    <link href="<?php echo PUBLIC_URL; ?>uikit/css/uikit.css" rel="stylesheet">
    <link href="<?php echo PUBLIC_URL; ?>system/css/login.css" rel="stylesheet">
    <script src="<?php echo PUBLIC_URL; ?>system/js/jquery.js"></script>
    <script src="<?php echo PUBLIC_URL; ?>uikit/js/uikit.js"></script>
</head>

<body class="uk-height-1-1">
    <div class="dux-login uk-vertical-align uk-text-center">
        <div class="uk-vertical-align-middle">
            <div class="dux-container">
                <img class="login-logo" src="<?php echo PUBLIC_URL; ?>system/images/logo.svg" width="100" height="100" alt="DuxDDF">
                <div class="pk-system-messages">
                    
                </div>
                <form class="login-body js-login uk-form" action="{url('system/Login/index')}" method="post">
                    <div class="uk-form-row">
                        <input class="uk-form-large uk-width-1-1" type="text" name="username" value="" placeholder="用户名" autofocus>
                    </div>
                    <div class="uk-form-row">
                        <input class="uk-form-large uk-width-1-1" type="password" name="password" value="" placeholder="密码">
                    </div>
                    <div class="uk-form-row">
                        <button class="uk-button uk-button-primary uk-button-large uk-width-1-1" type="submit">登录</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</body>
<script>
    function errorMsg(info){
        html = '<div class="uk-alert uk-alert-danger" data-status="danger">' + info + '</div>';
        $('.pk-system-messages').html(html);
    }
    $('.js-login').submit(function (e) {
        e.preventDefault();
        $.post('{url("index")}', $('.js-login').serialize(), function (data) {
            if(data.status){
                window.location.href = data.url;
            }else{
                errorMsg(data.info);
            }
        }, 'json').error(function (e, error, msg) {
            errorMsg(msg);
        });
    });
</script>

</html>